<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>组合继承</title>
</head>
<body>
    <script>
        function Person(name,age,gender){
             this.name=name;
             this.age=age;
             this.gender=gender;
            //  this.say=function(){
            //      console.log('saying~~~~1');
            //  }

         }
         Person.prototype.say=function(){
            console.log('saying~~~~~~~~~2');
         }
         Person.prototype.eat=function(){
            console.log('eating~~~~~~~~~2');
         }

         function Student(name,age,gender,no){
            Person.call(this,name,age,gender);
            this.no=no;
            // this.say=function(){
            //      console.log('saying~~~~~~~~~3');
            //  }
         }

         Student.prototype=Object.create(Person.prototype);
         Student.prototype.constructor=Student;
         Student.prototype.test=function(){
            console.log('testing~~~~~~~~~3');
         }
        //  Student.prototype.say=function(){
        //          console.log('saying~~~~~~~~~4');
        // }

      var s1=  new Student('壮壮',18,'男','1001');
      console.log(s1);
       s1.say();

       // 按照原型链 __proto__ 往上找 方法 say
            // saying~~~~~~~~~3  自己内部
            // saying~~~~1       继承的内部
            // saying~~~~~~~~~4  自己外部
            // saying~~~~~~~~~2  继承外部

    </script>
</body>
</html>